package zeebe.gateway.Exclusive;

import io.zeebe.client.ZeebeClient;

public class ExclusiveGatewayDeploy {
    public static void main(String[] args) {
        System.out.println("创建Zeebe的连接");
        ZeebeClient client = ZeebeClient.newClientBuilder()
                .brokerContactPoint("localhost:26500")
                .usePlaintext()
                .build();

        System.out.println("部署工作流");
        String bpmnPath = "bpmn/exclusiveGateway.bpmn";
        client.newDeployCommand()
                .addResourceFromClasspath(bpmnPath)
                .send()
                .join();

        System.out.println("部署BigJobWorker");
        String bigType = "big";
        BigJobWorkerHandler bigHandler = new BigJobWorkerHandler(client);
        client.newWorker()
                .jobType(bigType)
                .handler(bigHandler)
                .open();

        System.out.println("部署smallJobWorker");
        String smallType = "small";
        SmallJobWorkerHandler smallHandler = new SmallJobWorkerHandler(client);
        client.newWorker()
                .jobType(smallType)
                .handler(smallHandler)
                .open();
    }
}
